<!DOCTYPE html>
<html lang="en">

<head>
    <title></title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
</head>

<body>
    <script>
        //图片轮播类
        var LoopImages = function (imgArr, container) {
            this.imageArray = imgArr; //轮播图片数组
            this.container = container; //轮播图片容器
        }
        LoopImages.prototype = {
            createImage: function () {
                console.log("LoopImages createImage function");
            }, //创建轮播图片
            changeImage: function () {
                console.log('LoopImages changeImage function');
            } //切换下一张图片            
        };
        //上下滑动切换类
        var SlideLoopImg = function (imgArr, container) {
            LoopImages.call(this, imgArr, container);
        }
        SlideLoopImg.prototype = new LoopImages();
        SlideLoopImg.prototype.changeImage = function () {
            console.log("SlideLoopImg changeImage function");
        }
        //渐隐切换类
        var FadeLoopImg = function (imaArr, container, arrow) {
            LoopImages.call(this, imgArr, container);
            this.arrow = arrow;
        }
        FadeLoopImg.prototype = new LoopImages();
        FadeLoopImg.prototype.changeImage = function () {
            console.log("SlideLoopImg changeImage function");
        }

        function prototypeExtend() {
            var F = function () {},
                args = arguments,
                i = 0,
                len = args.length;
            for (; i < len; i++) {
                for (var j in args[i]) {
                    F.prototype[j] = args[i][j];
                }
            }
            return new F();
        }
        var penguin = prototypeExtend({
                speed: 20,
                swim: function () {
                    console.log('游泳速度' + this.speed);
                }
            }, {
                run: function (speed) {
                    console.log("奔跑速度"+speed);
                }
            }, {
                jump: function () {
                    console.log('跳跃动作');
                }
            }

        );
        //游泳速度
        penguin.swim();
        //奔跑速度
        penguin.run(10);
        //跳跃动作
        penguin.jump()
    </script>
</body>

</html>